<template>
	<div class="body">
		<view class="content">
			<!-- dataInfo：滚动卡片数据  swiperIndex：滚动序列 @change：滚动事件-->
			<cc-scroolCard :dataInfo="data" :swiperIndex="swiperIndex" @change="swiperChangeClick"></cc-scroolCard>

		</view>
		<div class="null" v-if="data.headImgs === null||data.headImgs.length <= 0" @click="select">
			<image src="../../../static/null.png" mode="widthFix"></image>
			<div class="text">暂无海报快去新增吧</div>
		</div>

		<view>
			<div class="gc" v-if="data.headImgs === null||!data.headImgs.length <= 0"><a @click="select"
					style="position: relative; bottom: 2px; ">查看更多海报</a> <uni-icons type="forward"
					size="20"></uni-icons></div>
			<div class="gc"><a @click="fodder" style="position: relative; bottom: 2px; ">管理我的海报</a> <uni-icons
					type="forward" size="20"></uni-icons></div>
		</view>
		<view>
			<div class="bottom">
				<div class="w">
					<img src="../../../static/poster/保存图片@3x.png" alt="">
					<div>
						保存图片
					</div>
				</div>
				<div class="w">
					<img src="../../../static/poster/微信@3x.png" alt="">
					<div>
						分享微信好友
					</div>
				</div>
				<div class="v">
					<img src="../../../static/poster/朋友圈@3x.png" alt="">
					<div>
						分享朋友圈
					</div>
				</div>
			</div>

		</view>
		<div v-if="userInform.level != null&&userInform.level.value === 'AGENT_1'">
			<uni-fab ref="fab" :pattern="pattern" :popMenu="false" horizontal="right" vertical="bottom"
				direction="vertical" @fabClick="fabClick" />
		</div>
	</div>
</template>

<script>
	import Api from "../../../API/api";
	export default {
		data() {
			return {
				show: false,
				swiperIndex: 0,
				userInform: {},
				data: {
					headImgs: []
				},
				pattern: {
					color: '#7A7E83',
					backgroundColor: '#fff',
					selectedColor: '#007AFF',
					buttonColor: '#3c3e49',
					iconColor: '#fff',
					icon: 'forward'
				}
			}
		},
		onShow() {
			Api.getQr({
				type: "USER"
			}).then(x => {
				this.data.headImgs = x.data;
			})
			Api.getwxuser().then(res => {
				this.userInform = res.data;
			})
		},
		onLoad() {},
		methods: {
			swiperChangeClick(e) {
				this.swiperIndex = e.detail.current
				console.log("swiperIndex = " + this.swiperIndex);
			},
			fodder() {
				uni.navigateTo({
					url: '/pages/index/user/user_fodder'
				})
			},
			fabClick() {
				uni.redirectTo({
					url: '/pages/index/my_poster'
				})
			},
			//海报广场
			select() {
				uni.navigateTo({
					// url:'/pages/index/user/user_select'
					url: '/pages/index/user/user_a'
				})
			},
			//朋友圈 //TODO:未实现
			circleOfFriends() {}
		}
	}
</script>

<style lang="less" scoped>
	page {

		background: #f5f6fa;

	}

	.null {
		position: fixed;
		top: 40%;
		left: 50%;
		transform: translate(-50%, -50%);

		image {
			width: 200rpx;
		}

		.text {
			margin-top: 20rpx;
			color: #aaa;
			font-size: 26rpx;
		}
	}

	.gc {
		padding-top: 30px;
		text-align: center;
		font-size: 30rpx;
		color: #ccc;
	}

	.content {
		display: flex;
		padding-top: 10rpx;

	}

	.mytent {
		text-align: center;
		margin-top: 20px;
		font-size: 14;
	}

	.bottom {
		background-color: #fff;
		display: flex;
		justify-content: space-around;
		width: 100%;
		text-align: center;
		padding: 50rpx 30rpx 100rpx 30rpx;
		border-radius: 20rpx 20rpx 0 0;
		box-sizing: border-box;
		position: fixed;
		bottom: 0;

		img {
			height: 40px;
		}
	}
</style>